//
//  GongXiView.m
//  夺宝吧
//
//  Created by xiaocai on 15/8/12.
//  Copyright (c) 2015年 FangYuan. All rights reserved.
//

#import "GongXiView.h"

@implementation GongXiView

- (instancetype)init
{
    if (self = [super init]) {
        self.frame = CGRectMake(0, 0, WYMWITH, WYMHEIGHT);
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
        
        UIImageView *imgview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 20, WYMWITH, WYMHEIGHT-200*AUTOY)];
        imgview.contentMode = UIViewContentModeScaleAspectFit;
        imgview.image = [UIImage imageNamed:@"regist_success_con"];
        [self addSubview:imgview];
        //立即夺宝按钮
        UIButton *buyNowBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        buyNowBtn.frame = CGRectMake(0, 0, 100, 30);
        buyNowBtn.center = CGPointMake(WYMWITH/2, CGRectGetMaxY(imgview.frame)+30);
        [buyNowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        buyNowBtn.layer.borderColor = [UIColor whiteColor].CGColor;
        buyNowBtn.layer.borderWidth = 1.0;
        [buyNowBtn addTarget:self action:@selector(buyNowBtnOnClick) forControlEvents:UIControlEventTouchUpInside];
        [buyNowBtn setTitle:@"立即夺宝" forState:UIControlStateNormal];
        [self addSubview:buyNowBtn];
    }
    return self;
}
- (void)buyNowBtnOnClick
{
    [self removeFromSuperview];
    [[WYMainTabBarVC shareMainTaBarVC]changeSelectedWithIndex:0];
}
@end
